import request from "@/utils/request.js";


//获取文章分类接口
export const reqArticleCategory = () => {
    return request({
        url:"/my/cate/list",
        method:"get"
    })
}

//增加文章分类接口
export const reqAddArticleCategory = ({cate_name,cate_alias}) => {
    return request({
        url:"/my/cate/add",
        method:"post",
        data:{cate_name,cate_alias}
    })
}

//更新文章分类接口
export const reqUpdateArticleCategory = ({id,cate_name,cate_alias}) => {
    return request({
        url:"/my/cate/info",
        method:"put",
        data:{id,cate_name,cate_alias}
    })
}

//删除-文章分类
export const reqDeleteArticleCategory = (id) => {
    return request({
        url:"/my/cate/del",
        method:"delete",
        params:{id}
    })
}

//根据条件筛选出来的文章列表
export const reqArticleList = ({pagenum,pagesize,cate_id,state}) => {
    return request({
        url:"/my/article/list",
        method:"get",
        params:{pagenum,pagesize,cate_id,state}
    })
}

//删除一篇文章
export const reqDeleteArticle = (id) => {
    return request({
        url:"/my/article/info",
        method:"delete",
        params:{id}
    })
}

//发布一篇文章
//FormData表单数据对象
export const reqAddArticle = (FormData) => {
    return request({
        url:"/my/article/add",
        method:"post",
        data:FormData
    })
}

//获取某篇文章详情
export const reqArticleDetail = (id) => {
    return request({
        url:"/my/article/info",
        method:"get",
        params:{id}
    })
}

//获取某篇文章的分类信息
export const reqArticleCate = (id) => {
    return request({
        url:"/my/cate/info",
        method:'get',
        params:{id}
    })
}